package  
{
	import net.flashpunk.graphics.Image;
	import net.flashpunk.utils.Input;
	import net.flashpunk.FP;
	import net.flashpunk.World;
	

	/**
	 * ...
	 * @author Donatello
	 */
	public class SixScene extends World
	{
		[Embed(source = "img/kitchenAfter.png")]	private const IMG_BACK:Class;
		private var imgBack:Image;
		
		private var player:ShootGuy;
		private var enemy1:ShootGuy;
		private var enemy2:ShootGuy;
		private var enemy3:ShootGuy;
		
		private var time:Number = 3.0;
		public function SixScene() 
		{
			imgBack = new Image(IMG_BACK);
			imgBack.x = 0;
			imgBack.y = 0;
			addGraphic(imgBack);
			
			
			add(new Fire(97, 36));
			add(new Fire(296, 36));
			add(new Fire(320, 36));
			
			add(new Fire(600, 36));
			add(new Fire(490, 36));
			add(new Fire(400, 36));
			
			add(new Fire(130, 200));
			add(new Fire(140, 200));
			add(new Fire(150,200));
			
			player = new ShootGuy(700, 400,2,true);
			
			enemy1=new ShootGuy(-100, 400,5);
			enemy2=new ShootGuy(-300, 400,3);
			enemy3=new ShootGuy(-500,400,2);
			
			add(enemy1);
			add(enemy2);
			add(enemy3);
			
			
			add(player);
			
			
		}
		
		
		override public function update():void
		{
			if(player.collide("EnemyBullet",player.x,player.y))
			{
				FP.world = new SixScene();
				removeAll();
			}
		
			if ((enemy1.collide("Player", enemy1.x, enemy1.y) && enemy1.state == "walking") ||
				(enemy2.collide("Player", enemy2.x, enemy2.y) && enemy2.state == "walking") ||
				(enemy3.collide("Player", enemy3.x, enemy3.y) && enemy3.state == "walking"))
			{
				FP.world = new SixScene();
				removeAll();
			}
			
		
			if (player.x <= 0)
			{
				
				FP.world = new SeptScene();
				removeAll();
				
			}
					
			
			super.update();
		}
	}

}